package org.jeecg.modules.system.mapper;

import com.baomidou.mybatisplus.annotation.SqlParser;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.system.entity.SysRole;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 角色表 Mapper 接口
 * </p>
 *
 * @Author scott
 * @since 2018-12-19
 */
public interface SysRoleMapper extends BaseMapper<SysRole> {

   @Select("select count(0) from sys_user_role where user_id = #{mainId} and role_id = #{roleId}")
   Integer selectRoleExist(Map map);

    //------------------------------------S端-START--------------------------------------------------
    @SqlParser(filter = true)
    IPage<SysRole> findServerPage(Page<SysRole> page,@Param("bean") SysRole role);
    @SqlParser(filter = true)
    List<SysRole> queryServerRoleTreeList(String tenantId);
    @SqlParser(filter = true)
    void serverSave(@Param("bean") SysRole role);

    //------------------------------------S端-END----------------------------------------------------
}
